<layout name="Layout/layout" />

<div id="wrapper">
    <div class="col-md-2">
        <include file="Layout:left-menubar" />
    </div>

    <div class="col-md-10">
    <!-- Page Content -->
    <div id="page-content-wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12">
                    <h1>考点选择</h1>
                    <form id="select" class="form-horizontal" action="{:U('Home/Project/apply')}" method="post">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <div class="form-group">
                                    <label for="inputEmail3" class="col-sm-2 control-label">考点</label>
                                    <div class="col-sm-10">
                                        <foreach name="examcenterlist" item="v">
                                            <label class="radio-inline">
                                                <input name="examcenter" type="radio" value="{$v['id']}" mv={$v['name']}> {$v['name']}
                                            </label>
                                        </foreach>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">选择专业</label>
                                    <div class="col-sm-10">
                                        <foreach name="majornodes" item="v">
                                            <label class="checkbox-inline">
                                                <input class="majors" name="majors[]" type="checkbox" value="{$v['id']}" pid="{$v['pid']}" mv={$v['name']}> {$v['name']}
                                            </label>
                                        </foreach>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                    <button id="query" type="button" class="btn btn-default">报名</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- /#page-content-wrapper -->
    </div>
</div>
<!-- /#wrapper -->
<!-- Modal -->
<div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">确认你要提交的信息</h4>
      </div>
      <div class="modal-body">
          <div>你选择的考点是：<span id="provinceModal">四川</span></div>
          <div id="majorModal">你选择的专业是：<span >美术类</span></div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary" id="submit">报名并前往缴费</button>
      </div>
    </div>
  </div>
</div>
<script>
window.onload = function(){
    $('input[type=checkbox]').click(function(){
        $(this).attr('checked', 'checked');
    });
    $('input[type=radio]').click(function(){
        $(this).attr('checked', 'checked');
    });
    $('#query').click(function(){
        $('#majorModal').text('你选择的专业是：');
        $('.majors:checked').each(function(){
            if($(this).attr('checked') == 'checked')
                $('#majorModal').append($(this).attr('mv'));
        });
        $('#provinceModal').text($('input[name=examcenter]:checked').attr('mv'));
        $('#confirmModal').modal();
    });
    $('#submit').click(function(){
        $('#select').submit();
    });
}
</script>
